Skip to content

[WIP] Add the secrets management documentation #11396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jderusse
Copy link
Member

This is a drat of the new secret management defined during the EU-FOSSA hackathon .

The PR is not yet ready, but would give an idea how it works

Copy link
Contributor

@noniagriconomie noniagriconomie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some little reviews :)
found some typo as well, but as the PR is WIP, I just wanted to review the idea

@wouterj
Copy link
Member

wouterj commented Apr 11, 2019

cc @mpdude as you wrote a blog post about this at EUFOSSA, you probably are interested in reviewing this as well 😃

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only typos for now

@jderusse jderusse force-pushed the secrets branch 3 times, most recently from 3dc07e9 to ffbf04c Compare April 15, 2019 15:13
Copy link
Contributor

@Simperfit Simperfit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this feature, it's really awsome !

@jderusse
Copy link
Member Author

Comments addressed. Thanks for the review @noniagriconomie, @Simperfit and @javiereguiluz

@javiereguiluz javiereguiluz added the Waiting Code Merge Docs for features pending to be merged label Sep 25, 2019
@jderusse jderusse force-pushed the secrets branch 2 times, most recently from 6443d0e to 713dd02 Compare October 18, 2019 15:12
@jderusse jderusse changed the base branch from master to 4.4 October 18, 2019 15:12
@jderusse jderusse force-pushed the secrets branch 2 times, most recently from 69c8b5e to 2746a57 Compare October 18, 2019 15:23
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

@jderusse jderusse force-pushed the secrets branch 2 times, most recently from 1f7105e to f656516 Compare October 18, 2019 22:00
fabpot added a commit to symfony/symfony that referenced this pull request Oct 20, 2019
…ecret:...)%` processor to deal with secrets seamlessly (Tobion, jderusse, nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Add `secrets:*` commands and `%env(secret:...)%` processor to deal with secrets seamlessly

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #27351
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/11396

This PR continues #31101, please see there for previous discussions. The attached patch has been fine-tuned on nicolas-grekas#33 with @jderusse.

This PR is more opinionated and thus a lot simpler than #31101: only Sodium is supported to encrypt/decrypt (polyfill possible), and only local filesystem is available as a storage, with little to no extension point. That's on purpose: the goal here is to provide an experience, not software building blocks. In 5.1, this might be extended and might lead to a new component, but we'd first need reports from real-world needs. Having this straight-to-the-point in 4.4 will allow gathering these needs (if they exist) and will immediately provide a nice workflow for the need we do want to solve now: forwarding secrets from dev to prod using git in a secure way.

The workflow this will allow is the following:
- public/private key pairs are generated in the `config/secrets/%kernel.environment%/` folder using `bin/console secrets:generate-keys`
- for the prod env, the corresponding private key should be deployed to the server using whatever means the hosting provider allows - this key MUST NOT be committed
- the public key is used to encrypt secrets and thus *may* be committed in the git repository to allow anyone *that can commit* to add secrets - this is done using `bin/console secrets:set`

DI configuration can reference secrets using `%env(secret:...)%` in e.g `services.yaml`.
There is also `bin/console secrets:remove` and `bin/console debug:secrets` to complete the toolbox.

In terms of design, vs #31101, this groups the dual "encoder" + "storage" concepts in a single "vault" one. That's part of what makes this PR simpler.

That's all folks :)

Commits
-------

c4653e1 Restrict secrets management to sodium+filesystem
02b5d74 Add secrets management
8c8f623 Proof of concept for encrypted secrets
@weaverryan
Copy link
Member

weaverryan commented Nov 8, 2019

Just dropping a note - need to talk about secrets:decrypt-to-local:

symfony/symfony#34295 (comment)

(should be added before composer dump-env prod)

@jderusse if it's cool with you, I can "take over" this PR soon, review it, and finish it. Nicolas has been keeping me up to date with the latest secrets tweaks, so I have an understanding of the current state.

@jderusse
Copy link
Member Author

jderusse commented Nov 8, 2019

@weaverryan Feel free to change that PR. beware, many thing are changing right now it the PR you gave

@wouterj wouterj removed the Waiting Code Merge Docs for features pending to be merged label Nov 22, 2019
@wouterj
Copy link
Member

wouterj commented Nov 23, 2019

Hi! What is the status of this PR? I would really like to have documentation on the great secrets management feature. Even if it's not complete, if what is in here is correct, I think we should merge it asap. We can then create more PRs and issues to document the missing bits.

@jderusse
Copy link
Member Author

@weaverryan Are you still working on this? Should I rebase and update my PR?

@weaverryan
Copy link
Member

I'm working on this - will get it done shortly - it's a big priority for me too :). I don't want to merge as-is, because much changed in the late stages of the feature, so I'm worried it's not accurate enough to be there yet.

Local secrets
-------------

It's common for developpers to use their own privates secrets (for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It's common for developpers to use their own privates secrets (for
It's common for developers to use their own privates secrets (for

Local secrets
-------------

It's common for developpers to use their own privates secrets (for
Copy link

@KasparRosin KasparRosin Jan 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It's common for developpers to use their own privates secrets (for
It's common for developpers to use their own private secrets (for


.. code-block:: terminal

$ php bin/console secrets:remove DATABASE_PASSWORD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ php bin/console secrets:remove DATABASE_PASSWORD
$ php bin/console secrets:list DATABASE_PASSWORD

@weaverryan
Copy link
Member

Finished finally (sorry!) over at #12958

@weaverryan weaverryan closed this Jan 18, 2020
weaverryan added a commit that referenced this pull request Jan 27, 2020
…rryan)

This PR was merged into the 4.4 branch.

Discussion
----------

Symfony 4.4 secrets management system

Hi!

This completes #11396

I also made some changes to the section in `configuration.rst` about environment variables to make sure that it read well with the secrets stuff.

Thanks to @jderusse for doing the vast majority of the work.

Cheers!

Commits
-------

cd066cc tweaks thanks to review
75e5ae6 finishing the secrets documentation
82d2058 Add the secret documentation
@jderusse jderusse deleted the secrets branch April 18, 2020 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.